<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%@ include file="inc/connmysql.jsp"%>
<%@ include file="utils/function.jsp"%>
<%
//这里面直接写业务逻辑代码
String name1=toUTF(request.getParameter("name"));
String number1=toUTF(request.getParameter("number"));
String subject1=toUTF(request.getParameter("subject"));
String score1=toUTF(request.getParameter("score"));
//保存数据到数据库
PreparedStatement psmt=conn.prepareStatement("UPDATE information SET name=?,number=?,subject=?,score=? where number=number");
psmt.setString(1, name1);
psmt.setString(2, number1);
psmt.setString(3, subject1);
psmt.setString(4, score1);
psmt.executeUpdate();

//软件重构：改善代码的既有设计
response.sendRedirect("main.jsp");
%>
<%@ include file="inc/connmysql_close.jsp"%>
